<my-plugin-navigation [pluginType]="pluginType"></my-plugin-navigation>

<div class="alert pt-alert-primary" i18n *ngIf="pluginInstalled">
  To load your new installed plugins or themes, refresh the page.
</div>

<div class="result-and-search">
  <ng-container *ngIf="!search">
    <my-global-icon iconName="trending" aria-hidden="true"></my-global-icon>
    <ng-container *ngIf="!isThemeSearch()" i18n>Popular plugins</ng-container>
    <ng-container *ngIf="isThemeSearch()" i18n>Popular themes</ng-container>
  </ng-container>

  <ng-container *ngIf="search && !isSearching">
    <my-global-icon iconName="search"></my-global-icon>

    <ng-container i18n>
      {{ pagination.totalItems }} {pagination.totalItems, plural, =1 {result} other {results}} for "{{ search }}"
    </ng-container>
  </ng-container>

  <div class="search-bar">
    <input type="text" (input)="onSearchChange($event)" i18n-placeholder placeholder="Search..." myAutofocus />
  </div>
</div>

<div class="no-results" i18n *ngIf="pagination.totalItems === 0">
  No results.
</div>

<div class="plugins" myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()">
  <ng-container *ngFor="let plugin of plugins" >
    <my-plugin-card [plugin]="plugin" [version]="plugin.latestVersion" [pluginType]="pluginType">
      <div ngProjectAs="badges">
        <span i18n *ngIf="plugin.installed" class="pt-badge badge-success">Installed</span>

        <span *ngIf="plugin.official" class="pt-badge badge-primary" i18n i18n-title title="This plugin is developed by Framasoft">
          Official
        </span>
      </div>

      <div ngProjectAs="buttons">
        <my-edit-button
          *ngIf="plugin.installed === true && !isThemeSearch()" [ptRouterLink]="getShowRouterLink(plugin)"
          label="Settings" i18n-label [responsiveLabel]="true"
        ></my-edit-button>

        <my-button
          *ngIf="plugin.installed === false" (click)="install(plugin)"
          [loading]="isInstalling(plugin)" label="Install" [responsiveLabel]="true"
          icon="cloud-download" [attr.disabled]="isInstalling(plugin)"
        ></my-button>
      </div>

    </my-plugin-card>
  </ng-container>
</div>
